<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>视频管理</title>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="viewCourse">
    <template class="data">
        <el-input
                style="width:30%;margin-bottom: 10px;color: blue"
                placeholder="请输入搜索内容"
                v-model="query"
                @change="search"
                clearable>
        </el-input>
        <el-table
                :data="tableData"
                border
                style="width: 817px">
            <el-table-column
                    prop="pic"
                    label="专辑封面"
                    width="169">
            </el-table-column>
            <el-table-column
                    prop="albumId"
                    label="专辑ID"
                    width="169">
            </el-table-column>
            <el-table-column
                    prop="name"
                    label="专辑名"
                    width="169">
            </el-table-column>
            <el-table-column label="操作" width="308" >
                <template slot-scope="scope">
                    <!--                    <el-button type="primary" size="small" icon="el-icon-edit"   circle @click="update(scope.row.vid)" ></el-button>-->
                    <!--                    <el-button type="danger"  size="small" icon="el-icon-delete" circle @click="deleteUser(scope.row.vid)" ></el-button>-->
                </template>
            </el-table-column>
        </el-table>
        <!--分页-->
        <el-pagination
                :current-page="current"
                :page-size="limit"
                :total="total"
                style="padding:30px 0; margin-top:20px; text-align: center;"
                layout="prev, pager, next"
                @current-change="getAlbumList"></el-pagination>
    </template>
</div>

<script src="../../js/vue.js"></script>
<script src="../../js/axios.min.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>

    new Vue({
        el:'#viewCourse',
        data : function (){
            return{
                tableData: [],  //表格中的所有数据
                current:0,      //当前页码
                limit:3,        //每页展示记录数
                total:0,        //总记录数
                query:''        //查询条件
            }
        },
        created(){
            this.getAlbumList()
        },
        methods: {
            search(){
                this.getAlbumList()
            },
            getAlbumList(page=1){
                this.current = page
                axios.get('/viewAlbum?current='+this.current+'&query='+this.query)
                    .then(response=>{
                        console.log(response)
                        this.tableData = response.data.data.pageInfo.list
                        this.current = response.data.data.pageInfo.pageNum
                        this.total = response.data.data.pageInfo.total
                        this.query = response.data.data.query
                    })
                    .catch(error=>{
                        console.log(error)
                    })
            },

        }
    })
</script>

</body>
</html>